<template>
  <div>
    <h2>用户注册</h2>
    <input type="text" v-model="uname">
    <span>{{masg}}</span>
  </div>
</template>

<script>
import axios from 'axios'
export default {
 data () {
  return {
    uname :'zhangsan',
    masg : ''
  }
 },
 watch: {
  async uname(val) {
    if (val === '') {
      this.masg = ''
      return
    }
    const {data:res} = await axios.get('http://www.itcbc.com:3006/api/finduser/' + val)
    this.masg = res.message
  }
 }
}
</script>
 
<style>

</style>